package chapter02.protoType;
//原型模式的测试类
public class ProtoTypeTest {
	public static void main(String[] args) throws CloneNotSupportedException {
		Realizetype obj1 = new Realizetype();
		Realizetype obj2 = (Realizetype) obj1.clone();
        System.out.println("obj1==obj2 ?"+(obj1==obj2));
	}
}
//具体原型的实现类
class Realizetype implements Cloneable{
    Realizetype(){
        System.out.println("具体原型创建成功！");
    }
    public Object clone() throws CloneNotSupportedException{
        System.out.println("具体原型拷贝成功！");
        return (Realizetype) super.clone();
    }
}
